package org.hoyi.util;

import java.io.IOException;

import javax.servlet.http.HttpServletResponse;

import org.hoyi.dispatchs.responseUtil;
import org.hoyi.disptachs.model.JsonModel;

/**
 *          Author:ellen
 *          Email:ellen@kuaifish.com
 *          CreateDate:2015-05-20
 *          ModifyDate:2015-06-20
 *          hoyi entities @ hoyi.org
 *          使用请在项目关于内标注hoyi版权，
 *          hoyi版权归hoyi.org所有
 */
public class HandlerUtil {
	public static void HandlerEx(HttpServletResponse response,
			String HandlerType, int ret) throws IOException {
		String msg = HandlerType;
		if (ret > 0){
			msg += "成功";
			System.out.println(HandlerType + " Success!");
		}
		else {
			msg += "失败";
			System.out.println(HandlerType + " Failed!");
		}
		JsonModel model = new JsonModel(ret, msg, null);
		responseUtil.getinstance().WriteUTF8JSON(response, model);
	}
}
